package cn.funnyxb.tools.appFrame.database;

import java.util.ArrayList;
import java.util.Iterator;

public class SelectWhere
{
  private ArrayList<SelectCondition> conditions;

  public void addCondition(SelectCondition paramSelectCondition)
  {
    if (paramSelectCondition == null);
    while (true)
    {
      return;
      if (this.conditions == null)
        this.conditions = new ArrayList();
      this.conditions.add(paramSelectCondition);
    }
  }

  public String getSql()
  {
    Object localObject;
    if ((this.conditions == null) || (this.conditions.size() <= 0))
    {
      localObject = "";
      return localObject;
    }
    String str1 = "";
    int i = 0;
    Iterator localIterator = this.conditions.iterator();
    label36: SelectCondition localSelectCondition;
    String str2;
    do
    {
      if (!(localIterator.hasNext()))
        localObject = str1;
      localSelectCondition = (SelectCondition)localIterator.next();
      str2 = localSelectCondition.getConditionSql();
    }
    while ((str2 == null) || (str2.trim().length() <= 0));
    if (i != 0)
      str1 = str1 + " and ";
    while (true)
    {
      str1 = str1 + localSelectCondition.getConditionSql();
      break label36:
      i = 1;
    }
  }

  public String getSqlWithWhere()
  {
    String str1 = getSql();
    if ((str1 == null) || (str1.trim().length() <= 0));
    for (String str2 = ""; ; str2 = " where " + str1)
      return str2;
  }

  public static abstract class SelectCondition
  {
    public abstract String getConditionSql();
  }

  public static class SelectCondition_Enumerate extends SelectWhere.SelectCondition
  {
    private String key = null;
    private String[] values;

    public SelectCondition_Enumerate(String paramString, String[] paramArrayOfString)
    {
      this.key = paramString;
      this.values = paramArrayOfString;
    }

    public String getConditionSql()
    {
      if ((this.key == null) || (this.values == null) || (this.values.length <= 0));
      String str2;
      int i;
      String[] arrayOfString;
      int k;
      for (String str1 = null; ; str1 = str2 + ")")
      {
        return str1;
        str2 = this.key + " in ( ";
        i = 0;
        arrayOfString = this.values;
        int j = arrayOfString.length;
        k = 0;
        label65: if (k < j)
          break;
      }
      String str3 = arrayOfString[k];
      if (i != 0)
        str2 = str2 + ",";
      while (true)
      {
        str2 = str2 + str3 + " ";
        ++k;
        break label65:
        i = 1;
      }
    }
  }

  public static class SelectCondition_Range extends SelectWhere.SelectCondition
  {
    private boolean isLowerValueEnabled;
    private boolean isUpperValueEnabled;
    private String key = null;
    private int lowerValue;
    private int upperValue;

    public SelectCondition_Range(String paramString, boolean paramBoolean1, int paramInt1, boolean paramBoolean2, int paramInt2)
    {
      this.key = paramString;
      this.lowerValue = paramInt1;
      this.upperValue = paramInt2;
      this.isLowerValueEnabled = paramBoolean1;
      this.isUpperValueEnabled = paramBoolean2;
    }

    public String getConditionSql()
    {
      Object localObject;
      if ((!(this.isUpperValueEnabled)) && (!(this.isLowerValueEnabled)))
      {
        localObject = "";
        label18: return localObject;
      }
      String str2;
      if ((this.isUpperValueEnabled) && (this.isLowerValueEnabled))
      {
        if (this.lowerValue < this.upperValue);
        for (String str3 = " and "; ; str3 = " or ")
        {
          str2 = this.key + " >= " + this.lowerValue + str3 + this.key + " <= " + this.upperValue;
          label105: localObject = str2;
          break label18:
        }
      }
      String str1;
      label129: StringBuilder localStringBuilder;
      if (this.isUpperValueEnabled)
      {
        str1 = " <= ";
        localStringBuilder = new StringBuilder(String.valueOf(this.key)).append(str1);
        if (!(this.isUpperValueEnabled))
          break label179;
      }
      for (int i = this.upperValue; ; i = this.lowerValue)
      {
        str2 = i;
        break label105:
        str1 = " >= ";
        label179: break label129:
      }
    }
  }
}

/* Location:           E:\Desktop\复件 classes_dex2jar.jar
 * Qualified Name:     cn.funnyxb.tools.appFrame.database.SelectWhere
 * JD-Core Version:    0.5.3
 */